import React from "react";
import { useState } from "react";
export default function InputNumber(props) {
  const [value, setValue] = useState(props.defaultValue || 0);
  const onChange = (e) => {
    var val = e.target.value;
    val = val.replace(/\D/g, "");
    setValue(val);
    props.onChange && props.onChange(val);
  };
  return <input type="text" value={value} onChange={(e) => {onChange(e)}} />;
}
